<template>
	<view>
		<!-- <view class="ac-body u-p-30">
			<view class="btn-group u-flex">
				<view class="u-flex-1 u-m-r-30">
					<view class="big-btn bg-gradual-blue" @click="scan">
						<u-icon name="scan" size="60"></u-icon>
						<text class="u-font-32 u-m-t-10">扫码收货</text>
					</view>
				</view>

				<view class="u-flex-1">
					<navigator class="big-btn bg-gradual-blue" url="/pages/shop/income/user/create/create">
						<u-icon name="plus" size="60"></u-icon>
						<text class="u-font-32 u-m-t-10">手动收货</text>
					</navigator>
				</view>
			</view>
		</view> -->
		<view class="ac-head">
			<text class="u-font-24">单据管理</text>
		</view>
		<view class="ac-body u-m-t-10">
			<view class="head-item">
				<view class="u-flex-1"><text class="bold">入库</text></view>
				<navigator url="/pages/shop/income/user/create/create" class="u-border-left u-p-l-30 u-h-100 more">
					<text class="iconfont icon-tag24fuben"></text>
					<text class="u-p-l-15">新建收货</text>
				</navigator>
			</view>
			<view class="body-item u-border-top">
				<navigator url="/pages/shop/income/user/list/list" class="cell u-flex-1">
					<view class="u-flex">
						<view class="icon i1"><text class="iconfont icon-kehuguanli"></text><u-badge type="error" :count="0" :offset="[-8, -8]"></u-badge></view>
						<view>
							<view><text>站点回收单</text></view>
							<view class="u-p-t-6"><text class="u-tips-color u-font-24">站点收货</text></view>
						</view>
					</view>
				</navigator>
				<navigator url="/pages/shop/income/list/list" class="cell u-flex-1">
					<view class="u-flex">
						<view class="icon i1"><text class="iconfont icon-ruku1"></text><u-badge type="error" :count="num" :offset="[-8, -8]"></u-badge></view>
						<view>
							<view><text>入库单</text></view>
							<view class="u-p-t-6"><text class="u-tips-color u-font-24">入库到站点</text></view>
						</view>
					</view>
				</navigator>
			</view>
		</view>
		<view class="ac-body u-m-t-10">
			<view class="head-item">
				<view class="u-flex-1"><text class="bold">出库</text></view>
				<navigator url="/pages/shop/outbound/create/create" class="u-border-left u-p-l-30 u-h-100 more">
					<text class="iconfont icon-tag24fuben"></text>
					<text class="u-p-l-15">新建出库</text>
				</navigator>
			</view>
			<view class="body-item u-border-top">
				<navigator url="/pages/shop/outbound/list/list" class="cell u-flex-1">
					<view class="u-flex">
						<view class="icon i1"><text class="iconfont icon-chuku1"></text><u-badge type="error" :count="0" :offset="[-8, -8]"></u-badge></view>
						<view>
							<view><text>出库单</text></view>
							<view class="u-p-t-6"><text class="u-tips-color u-font-24">站点出库单据</text></view>
						</view>
					</view>
				</navigator>
				<!-- <navigator url="" class="cell u-flex-1">
					<view class="u-flex">
						<view class="icon i2"><text class="iconfont icon-tongji3"></text></view>
						<view>
							<view><text>出库统计</text></view>
							<view class="u-p-t-6"><text class="u-tips-color u-font-24">我的出库统计</text></view>
						</view>
					</view>
				</navigator> -->
			</view>
		</view>
		<view class="ac-head">
			<text class="u-font-24">其他</text>
		</view>
		<view class="ac-body">
			<view class="body-item u-border-top u-text-center">
				<navigator url="/pages/shop/scan/integral/integral" class="cell u-w-187">
					<view class="icon i1"><text class="iconfont icon-jifen"></text></view>
					<view class="name">
						<view><text>积分消费</text></view>
					</view>
				</navigator>
				<navigator url="/pages/shop/staff/staff" class="cell u-w-187" v-if="isOperatorAdmin || isFranchiseAdmin || isStoreAdmin">
					<view class="icon i1"><text class="iconfont icon-kehuguanli"></text></view>
					<view class="name">
						<view><text>店员管理</text></view>
					</view>
				</navigator>
				<navigator url="/pages/shop/cashRecord/cashRecord" class="cell u-w-187">
					<view class="icon i1"><text class="iconfont icon-jichandanjia"></text></view>
					<view class="name">
						<view><text>现金记录</text></view>
					</view>
				</navigator>
			</view>
		</view>
		<view class="ac-head">
			<text class="u-font-24">数据查询</text>
		</view>
		<view class="ac-body">
			<view class="body-item u-border-top u-text-center">
				<navigator url="/pages/shop/statistics/inventory/inventory" class="cell u-w-187">
					<view class="icon i1"><text class="iconfont icon-jiaotongyunshu"></text></view>
					<view class="name">
						<view><text>库存表</text></view>
					</view>
				</navigator>
				<!-- <navigator url="/pages/shop/statistics/storagePay/storagePay" class="cell u-w-187" v-if="isOperatorAdmin || isFranchiseAdmin || isStoreAdmin">
					<view class="icon i1"><text class="iconfont icon-qian"></text></view>
					<view class="name">
						<view><text>入库支出</text></view>
					</view>
				</navigator> -->
				<navigator url="/pages/shop/statistics/storeSell/storeSell" class="cell u-w-187" v-if="isOperatorAdmin || isFranchiseAdmin || isStoreAdmin">
					<view class="icon i1"><text class="iconfont icon-jifen"></text></view>
					<view class="name">
						<view><text>出库销售</text></view>
					</view>
				</navigator>
			</view>
		</view>
		<!-- 可回收物管理 -->
		<!-- <view class="ac-head" v-if="isOperatorAdmin">
			<text class="u-font-24">可回收物管理</text>
		</view>
		<view class="ac-body" v-if="isOperatorAdmin">
			<view class="body-item u-border-top u-text-center">
				<navigator url="/pages/admin/catalogue/catalogue" class="cell u-w-187">
					<view class="icon i1"><text class="iconfont icon-gongzuotai1"></text></view>
					<view class="name">
						<view><text>类型设置</text></view>
					</view>
				</navigator>
				<navigator url="/pages/admin/productList/productList" class="cell u-w-187">
					<view class="icon i1"><text class="iconfont icon-kehuishouwu-icon"></text></view>
					<view class="name">
						<view><text>可回收物设置</text></view>
					</view>
				</navigator>
				<navigator url="/pages/admin/priceTable/priceTable" class="cell u-w-187">
					<view class="icon i1"><text class="iconfont icon-jichandanjia"></text></view>
					<view class="name">
						<view><text>价格表</text></view>
					</view>
				</navigator>
			</view>
		</view> -->
		<!-- 底部菜单 -->
		<tabbar :current="1"></tabbar>
	</view>
</template>

<script>
	import {
		mapState
	} from 'vuex';
	import tabbar from '../components/tabbar/tabbar.vue'
	
	export default {
		components:{
			tabbar
		},
		data() {
			return {
				num: 0
			}
		},
		computed: {
			...mapState({
				storeId: state => state.storeId,
				franchiseId: state => state.franchiseId,
				operatorId: state => state.operatorid
			}),
			// 是否运营商管理员
			isOperatorAdmin(){
				return this.userdetail.bindinfo.operator.ismanager
			},
			// 是否自营的运营商
			isOperatorProprietary(){
				return this.userdetail.bindinfo.operator.isproprietary
			},
			// 是否加盟商管理员
			isFranchiseAdmin(){
				return this.userdetail.bindinfo.operator.franchiselist.find((item)=>item.id == this.franchiseId).ismanager
			},
			// 是否（当前）站点的管理员
			isStoreAdmin(){
				return this.userdetail.bindinfo.operator.franchiselist.find((item)=>item.id == this.franchiseId).storelist.find((item)=>item.id == this.storeId).ismanager
			}
		},
		onShow() {
			this.$u.post('/Store/InOrder/List', {
				"storeId": this.storeId,
				"state": 0,
				"orderType": 1 //0全部，1.小哥入库单，2.线下单
			}).then((res) => {
				this.num = res.total
			})
		}
	}
</script>

<style lang="scss" scoped>
	// 按钮组
	.btn-group {
		.big-btn {
			height: 180rpx;
			display: flex;
			flex-direction: column;
			align-items: center;
			justify-content: center;
			border-radius: 10rpx;
		}
	}
	
	.ac-head{
		margin-left: 30rpx;
		margin-right: 30rpx;
		margin-top: 10rpx;
		margin-bottom: 10rpx;
	}
	.ac-body{
		background-color: #fff;
		.head-item{
			display: flex;
			align-items: center;
			height: 100rpx;
			padding: 0 30rpx;
			.more{
				display: flex;
				align-items: center;
			}
		}
		.body-item{
			display: flex;
			flex-wrap: wrap;
			align-content: center;
			.cell{
				padding: 30rpx;
				box-sizing: border-box;
				.name{
					margin-top: 15rpx;
					padding-right: 15rpx;
				}
			}
		}
	}
	.icon{
		color: #fff;
		height: 110rpx;
		width: 110rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		border-radius: 16rpx;
		margin-right: 20rpx;
		position: relative;
		&.sp{
			margin-right: 0;
		}
		.iconfont{
			font-size: 56rpx;
		}
		&.i1{
			background-color: $u-color-main;
		}
		&.i2{
			background-color: $u-color-blue;
		}
		&.i3{
			background-color: $u-color-purple;
		}
		&.i4{
			background-color: $u-color-pink;
		}
		&.i5{
			background-color: $u-color-red;
		}
		&.i6{
			background-color: $u-color-orange;
		}
		&.i7{
			background-color: $u-color-yellow;
		}
		&.i8{
			background-color: $u-color-green;
		}
		&.i9{
			background-color: $u-color-teal;
		}
		&.i10{
			background-color: $u-color-cyan;
		}
		&.i11{
			background-color: $u-color-secondary;
		}
	}
</style>